package com.telit.firecommand.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.telit.firecommand.dao.GeoXzqhCunDao;
import com.telit.firecommand.dto.GeoCunDTO;
import com.telit.firecommand.entity.GeoXzqhCun;
import com.telit.firecommand.service.IGeoXzqhCunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yummy
 * @since 2021-10-20
 */
@Service
@Transactional
public class GeoXzqhCunServiceImpl extends ServiceImpl<GeoXzqhCunDao, GeoXzqhCun> implements IGeoXzqhCunService {

    @Autowired
    private GeoXzqhCunDao geoXzqhCunDao;

    /**
     * 根据经纬度查询行政区划
     *
     * @param longitude 经度
     * @param latitude  纬度
     *
     * @return 行政区划
     */
    @Override
    public GeoCunDTO getDistrictByPoint(String longitude, String latitude) {
        return geoXzqhCunDao.getDistrictByPoint(longitude, latitude);
    }


    /**
     * 根据code查找行政区划名称
     * @param code
     * @return
     */
    public String getNameFromCode(String code){
        return geoXzqhCunDao.queryNameByCode(code,code.length());
    }

}
